﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightParser
{
    public class Bridge
    {
        public static List<Semantics.Silverlight.LanguageNode> ConvertToSilverLangNodeArray(IList<SilverWebService.LanguageNode> langnodes)
        {
            List<Semantics.Silverlight.LanguageNode> slns = new List<Semantics.Silverlight.LanguageNode>();
            foreach(SilverWebService.LanguageNode langnode in langnodes)
                slns.Add(ConvertToSilverLangNode(langnode));
            return slns;
        }
        public static Semantics.Silverlight.LanguageNode ConvertToSilverLangNode(SilverWebService.LanguageNode langnode)
        {
            Semantics.Silverlight.LanguageNode ln = new Semantics.Silverlight.LanguageNode();
            ln.AbsolutePos = langnode.AbsolutePos;
            ln.Value = langnode.Value;
            if (langnode.Children != null)
            {
                foreach (SilverWebService.LanguageNode child in langnode.Children)
                    ln.Children.Add(ConvertToSilverLangNode(child));
            }
            return ln;
        }
    }
}
